<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Max</title>
</head>
<body>
	<script type="text/javascript">
		
		function getMax(values){
			var maxValue = values[0];  //先把数组的第一个值赋值给一个变量
			for( var i = 1 ; i < values.length ; i++ ){
				if( maxValue < values[i] ){
					maxValue = values[i];
				}				
			}
			return maxValue;
		}
		arr = [1,56,23,6,43,87,3,5,55,105,111,125];
		document.write( "最大值是" + getMax( arr ));
	</script>
</body>
</html>